/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kmcsoft.goldshop.importgold;

import com.kmcsoft.goldshop.importgold.service.ImportGoldService;
import com.kmcsoft.goldshop.model.scm.ImportGoldOrder;
import com.kmcsoft.spring.SpringUtil;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkplus.databind.TypeConverter;

/**
 *
 * @author kmcsoft02
 */
public class SizeConverter implements TypeConverter{

    public Object coerceToUi(Object val, Component comp) {
        if(val instanceof Long){
            ImportGoldService importGoldService=SpringUtil.getBean("importGoldService", ImportGoldService.class);
            ImportGoldOrder order =importGoldService.getImportGoldOrderById(val);
            return "" +order.getDetails().size();
        }
        return "";
    }

    public Object coerceToBean(Object val, Component comp) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
